<template>
    <div class="approval">
        <!-- 面包屑导航 -->
        <div class="page_top">
            <div class="left_btn" @click="back">
                <img src="../../assets/image/back.png" alt="" />
            </div>
            <crumbs basetitle="保险" title="长期保设置" :title1="cubTitle"></crumbs>
        </div>
        <div class="outtabbox">
            <div class="outtabitem" @click="changeouttab(0)">
                <div class="content">
                    <div :class="{ tabtext: true, blueactiveword: outtabflag === 0 }">方案管理</div>
                </div>
                <div class="border_b">
                    <div :class="{ line: true, blueactiveline: outtabflag === 0 }"></div>
                </div>
            </div>
            <div class="outtabitem" @click="changeouttab(1)">
                <div class="content">
                    <div :class="{ tabtext: true, blueactiveword: outtabflag === 1 }">行业管理</div>
                </div>
                <div class="border_b">
                    <div :class="{ line: true, blueactiveline: outtabflag === 1 }"></div>
                </div>
            </div>
            <div class="outtabitem" @click="changeouttab(2)">
                <div class="content">
                    <div :class="{ tabtext: true, blueactiveword: outtabflag === 2 }">保司管理</div>
                </div>
                <div class="border_b">
                    <div :class="{ line: true, blueactiveline: outtabflag === 2 }"></div>
                </div>
            </div>
            <div class="outtabitem" v-if="false" @click="changeouttab(3)">
                <div class="content">
                    <div :class="{ tabtext: true, blueactiveword: outtabflag === 3 }">禁保区域管理</div>
                </div>
                <div class="border_b">
                    <div :class="{ line: true, blueactiveline: outtabflag === 3 }"></div>
                </div>
            </div>
            <div class="outtabitem" v-if="false" @click="changeouttab(4)">
                <div class="content">
                    <div :class="{ tabtext: true, blueactiveword: outtabflag === 4 }">禁保区域白名单</div>
                </div>
                <div class="border_b">
                    <div :class="{ line: true, blueactiveline: outtabflag === 4 }"></div>
                </div>
            </div>
        </div>
        <div v-show="outtabflag === 0">
            <managePlan />
            <!-- <div class="paddingbox">
                <div class="formbox">
                    <div class="top">
                        <div class="toptext">筛选</div>
                        <div class="utils">
                            <div class="clear">
                                <img src="../../assets/image/容器.png" alt="">
                                <span>清除</span>
                            </div>
                        </div>
                    </div>
                    <div class="formcontent">
                        <div class="formitem">
                            <div class="formitemflexone">
                                <div class="lable">保司：</div>
                                <el-select v-model="value" class="m-2 inputw" placeholder="请选择保司">
                                    <el-option v-for="item in options" :key="item.value" :label="item.label"
                                        :value="item.value" />
                                </el-select>
                            </div>
                            <div class="formitemflexone">
                                <div class="lable">方案名称：</div>
                                <el-select v-model="value" class="m-2 inputw" placeholder="请选择">
                                    <el-option v-for="item in options" :key="item.value" :label="item.label"
                                        :value="item.value" />
                                </el-select>
                            </div>
                        </div>
                        <div class="formbtnitem">
                            <el-button type="primary" class="my_btn"><el-icon>
                                    <Plus />
                                </el-icon>新增方案</el-button>
                        </div>
                    </div>
                </div>
            </div>
            <div class="paddingbox">
                <div class="accounttable">
                    <div class="tableborder">
                        <el-table :data="teamtableData" style="width: 100%; margin-top: 16px" height="480"
                            :header-cell-style="{
                                background: '#FAFAFC',
                                color: '#202536',
                            }">
                            <el-table-column align="center" prop="userName" label="姓名" />
                            <el-table-column align="center" prop="phone" label="手机号" />
                            <el-table-column align="center" prop="position" label="职位" />
                            <el-table-column align="center" prop="roleName" label="角色">
                            </el-table-column>
                            <el-table-column align="center" prop="isOpen" label="PC">
                                <template #default="scope">
                                    <span v-if="scope.row.isOpen === 1">已开通</span>
                                    <span v-else>未开通</span>
                                </template>
                            </el-table-column>
                            <el-table-column align="center" label="操作" width="260">
                                <template #default="scope">
                                    <div style="
                        display: flex;
                        align-items: center;
                        justify-content: space-around;
                      ">
                                        <el-button link style="color: #0256ff"
                                            @click="setorcanceladmin(scope.row)">设置超级管理员</el-button>
                                        <el-button link style="color: #0256ff"
                                            @click="changeroleapizzc(scope.row)">修改角色</el-button>
                                        <el-dropdown>
                                            <span style="color: #0256ff" class="el-dropdown-link">
                                                更多
                                            </span>
                                            <template #dropdown>
                                                <el-dropdown-menu>
                                                    <el-dropdown-item style="color: #0256ff" v-if="scope.row.isOpen === 0"
                                                        @click="openpczzc(scope.row)">开通PC</el-dropdown-item>
                                                    <el-dropdown-item style="color: #0256ff"
                                                        @click="okornologin(scope.row)">{{
                                                            scope.row.status === "0"
                                                            ? "禁止登录"
                                                            : "允许登录"
                                                        }}</el-dropdown-item>
                                                    <el-dropdown-item style="color: #0256ff"
                                                        @click="openresetpasswordzzc(scope.row)">重置密码</el-dropdown-item>
                                                    <el-dropdown-item v-if="scope.row.isAdmin === 1" style="color: #ee3737"
                                                        @click="setadmins(scope.row)">
                                                        取消管理员
                                                    </el-dropdown-item>
                                                    <el-dropdown-item v-if="scope.row.isAdmin === 0" style="color: #0256ff"
                                                        @click="setadmins(scope.row)">
                                                        设置管理员
                                                    </el-dropdown-item>
                                                </el-dropdown-menu>
                                            </template>
                                        </el-dropdown>
                                    </div>
                                </template>
                            </el-table-column>
                        </el-table>
                    </div>
                    <div class="paginationborder">
                        <pagination :total="teamtotal" :currentPage="teamcurrentPage" :pageSize="teampageSize"
                            @SizeChange="teamhandleSizeChange" @CurrentChange="teamhandleCurrentChange"></pagination>
                    </div>
                </div>
            </div> -->
        </div>
        <div v-show="outtabflag === 1">
            <manageIndustry />

            <!-- <div class="paddingbox">
                <div class="formbox">
                    <div class="top">
                        <div class="toptext">筛选</div>
                        <div class="utils">
                        </div>
                    </div>
                    <div class="formcontent">
                        <div class="formitem">
                            <div class="formitemflexone">
                                <el-input :prefix-icon="Search" v-model="input" style="width: 280px;"
                                    placeholder="请输入行业名称/工种名称/工种编码" clearable />
                            </div>
                        </div>
                        <div class="formbtnitem">
                            <el-button type="primary" class="my_btn"><el-icon>
                                    <Plus />
                                </el-icon>新增行业</el-button>
                        </div>
                    </div>
                </div>
            </div>
            <div class="paddingbox">
                <div class="accounttable">
                    <div class="tableborder">
                        <el-table :data="teamtableData" style="width: 100%; margin-top: 16px" height="480"
                            :header-cell-style="{
                                background: '#FAFAFC',
                                color: '#202536',
                            }">
                            <el-table-column align="center" prop="userName" label="姓名" />
                            <el-table-column align="center" prop="phone" label="手机号" />
                            <el-table-column align="center" prop="position" label="职位" />
                            <el-table-column align="center" prop="roleName" label="角色">
                            </el-table-column>
                            <el-table-column align="center" prop="isOpen" label="PC">
                                <template #default="scope">
                                    <span v-if="scope.row.isOpen === 1">已开通</span>
                                    <span v-else>未开通</span>
                                </template>
                            </el-table-column>
                            <el-table-column align="center" label="操作" width="260">
                                <template #default="scope">
                                    <div style="
                        display: flex;
                        align-items: center;
                        justify-content: space-around;
                      ">
                                        <el-button link style="color: #0256ff"
                                            @click="setorcanceladmin(scope.row)">设置超级管理员</el-button>
                                        <el-button link style="color: #0256ff"
                                            @click="changeroleapizzc(scope.row)">修改角色</el-button>
                                        <el-dropdown>
                                            <span style="color: #0256ff" class="el-dropdown-link">
                                                更多
                                            </span>
                                            <template #dropdown>
                                                <el-dropdown-menu>
                                                    <el-dropdown-item style="color: #0256ff" v-if="scope.row.isOpen === 0"
                                                        @click="openpczzc(scope.row)">开通PC</el-dropdown-item>
                                                    <el-dropdown-item style="color: #0256ff"
                                                        @click="okornologin(scope.row)">{{
                                                            scope.row.status === "0"
                                                            ? "禁止登录"
                                                            : "允许登录"
                                                        }}</el-dropdown-item>
                                                    <el-dropdown-item style="color: #0256ff"
                                                        @click="openresetpasswordzzc(scope.row)">重置密码</el-dropdown-item>
                                                    <el-dropdown-item v-if="scope.row.isAdmin === 1" style="color: #ee3737"
                                                        @click="setadmins(scope.row)">
                                                        取消管理员
                                                    </el-dropdown-item>
                                                    <el-dropdown-item v-if="scope.row.isAdmin === 0" style="color: #0256ff"
                                                        @click="setadmins(scope.row)">
                                                        设置管理员
                                                    </el-dropdown-item>
                                                </el-dropdown-menu>
                                            </template>
                                        </el-dropdown>
                                    </div>
                                </template>
                            </el-table-column>
                        </el-table>
                    </div>
                    <div class="paginationborder">
                        <pagination :total="teamtotal" :currentPage="teamcurrentPage" :pageSize="teampageSize"
                            @SizeChange="teamhandleSizeChange" @CurrentChange="teamhandleCurrentChange"></pagination>
                    </div>
                </div>
            </div> -->
        </div>
        <div v-show="outtabflag === 2">
            <manageInsureCompany />
            <!-- <div class="paddingbox">
                <div class="flexbox">
                    <div class="paddingbox_l">
                        <div class="paddingbox_ltitle">
                            <div>保司列表</div>
                            <img src="../../assets//image/添加部门.png" alt="">
                        </div>
                        <div :class="{ insurecompanylist: true, insurecompanylistactive: insurecompanyflag === 0 }"
                            @click="changeinsurecompany(0)">
                            <el-popover placement="top-start" :width="200" trigger="hover">
                                <template #reference>
                                    <img class="insurelogo" src="../../assets/image/admin-header.png" alt="">
                                </template>
                                <div style="display: flex; align-items: center;">
                                    <div><img style="width: 42px;height: 42px;margin-right: 12px;"
                                            src="../../assets/image/admin-header.png" alt="">
                                    </div>
                                    <div>
                                        <div style="font-size: 14px;">中国人寿</div>
                                        <div style="font-size: 12px;color: #9497B1;" class="insurepopovertype">保司</div>
                                    </div>
                                </div>
                                <div style="font-size: 12px; color: #555C6A;margin-top: 12px;">
                                    <div>
                                        <span>保司编码：</span><span>period_001_zgrs</span>
                                    </div>
                                    <div>
                                        <span>出单类型：</span><span>picc</span>
                                    </div>
                                </div>
                            </el-popover>
                            <div class="companyinfo">
                                <div><span class="insurename">中国人寿</span><span class="insureengname">picc</span></div>
                                <div class="insurecode">period_001_zgrs</div>
                            </div>
                            <el-popover placement="top-start" :width="118" trigger="click">
                                <template #reference>
                                    <img class="moreimg" src="../../assets/image/组871.png" alt="">
                                </template>
                                <div class="popoverfn">删除</div>
                                <div class="popoverfn">方案设置</div>
                            </el-popover>
                        </div>
                        <div :class="{ insurecompanylist: true, insurecompanylistactive: insurecompanyflag === 1 }"
                            @click="changeinsurecompany(1)">
                            <el-popover placement="top-start" :width="200" trigger="hover">
                                <template #reference>
                                    <img class="insurelogo" src="../../assets/image/admin-header.png" alt="">
                                </template>
                                <div style="display: flex; align-items: center;">
                                    <div><img style="width: 42px;height: 42px;margin-right: 12px;"
                                            src="../../assets/image/admin-header.png" alt="">
                                    </div>
                                    <div>
                                        <div style="font-size: 14px;">中国人寿</div>
                                        <div style="font-size: 12px;color: #9497B1;" class="insurepopovertype">保司</div>
                                    </div>
                                </div>
                                <div style="font-size: 12px; color: #555C6A;margin-top: 12px;">
                                    <div>
                                        <span>保司编码：</span><span>period_001_zgrs</span>
                                    </div>
                                    <div>
                                        <span>出单类型：</span><span>picc</span>
                                    </div>
                                </div>
                            </el-popover>
                            <div class="companyinfo">
                                <div><span class="insurename">中国人寿</span><span class="insureengname">picc</span></div>
                                <div class="insurecode">period_001_zgrs</div>
                            </div>
                            <el-popover placement="top-start" :width="118" trigger="click">
                                <template #reference>
                                    <img class="moreimg" src="../../assets/image/组871.png" alt="">
                                </template>
                                <div class="popoverfn">删除</div>
                                <div class="popoverfn">方案设置</div>
                            </el-popover>
                        </div>
                    </div>
                    <div class="paddingbox_r">
                        <div class="toptitle">保司保单号</div>
                        <div class="form">
                            <div>
                                <span>生效年月：</span>
                                <el-date-picker v-model="value2" type="month" placeholder="选择日期" />
                            </div>
                            <el-button type="primary" size="default" class="my_btn"><el-icon>
                                    <Plus />
                                </el-icon>批量保单号</el-button>
                        </div>
                        <div style="margin-top: 12px;">
                            <el-table :data="teamtableData" style="width: 100%; margin-top: 16px" height="570"
                                :header-cell-style="{
                                    background: '#FAFAFC',
                                    color: '#202536',
                                }">
                                <el-table-column align="center" prop="userName" label="姓名" />
                                <el-table-column align="center" prop="phone" label="手机号" />
                                <el-table-column align="center" prop="position" label="职位" />
                                <el-table-column align="center" prop="roleName" label="角色">
                                </el-table-column>
                                <el-table-column align="center" prop="isOpen" label="PC">
                                    <template #default="scope">
                                        <span v-if="scope.row.isOpen === 1">已开通</span>
                                        <span v-else>未开通</span>
                                    </template>
                                </el-table-column>
                                <el-table-column align="center" label="操作" width="260">
                                    <template #default="scope">
                                        <div style="
                        display: flex;
                        align-items: center;
                        justify-content: space-around;
                      ">
                                            <el-button link style="color: #0256ff"
                                                @click="setorcanceladmin(scope.row)">设置超级管理员</el-button>
                                            <el-button link style="color: #0256ff"
                                                @click="changeroleapizzc(scope.row)">修改角色</el-button>
                                            <el-dropdown>
                                                <span style="color: #0256ff" class="el-dropdown-link">
                                                    更多
                                                </span>
                                                <template #dropdown>
                                                    <el-dropdown-menu>
                                                        <el-dropdown-item style="color: #0256ff"
                                                            v-if="scope.row.isOpen === 0"
                                                            @click="openpczzc(scope.row)">开通PC</el-dropdown-item>
                                                        <el-dropdown-item style="color: #0256ff"
                                                            @click="okornologin(scope.row)">{{
                                                                scope.row.status === "0"
                                                                ? "禁止登录"
                                                                : "允许登录"
                                                            }}</el-dropdown-item>
                                                        <el-dropdown-item style="color: #0256ff"
                                                            @click="openresetpasswordzzc(scope.row)">重置密码</el-dropdown-item>
                                                        <el-dropdown-item v-if="scope.row.isAdmin === 1"
                                                            style="color: #ee3737" @click="setadmins(scope.row)">
                                                            取消管理员
                                                        </el-dropdown-item>
                                                        <el-dropdown-item v-if="scope.row.isAdmin === 0"
                                                            style="color: #0256ff" @click="setadmins(scope.row)">
                                                            设置管理员
                                                        </el-dropdown-item>
                                                    </el-dropdown-menu>
                                                </template>
                                            </el-dropdown>
                                        </div>
                                    </template>
                                </el-table-column>
                            </el-table>
                        </div>
                        <div>
                            <pagination :total="teamtotal" :currentPage="teamcurrentPage" :pageSize="teampageSize"
                                @SizeChange="teamhandleSizeChange" @CurrentChange="teamhandleCurrentChange"></pagination>
                        </div>
                    </div>
                </div>
            </div> -->
        </div>
        <div v-show="outtabflag === 3">
            <prohibitedAreaManagement />
        </div>
        <div v-show="outtabflag === 4">
            <addInsureWhiteList />
        </div>
    </div>
</template>

<script setup lang="ts">
import { ref, computed, onMounted } from 'vue'
import { Search } from '@element-plus/icons-vue'
import crumbs from '../../components/crumbs.vue'
import managePlan from './managePlan.vue'
import manageIndustry from './manageIndustry.vue'
import manageInsureCompany from './manageInsureCompany.vue'
import addInsureWhiteList from "./addInsureWhiteList.vue";
import ProhibitedAreaManagement from "./prohibitedAreaManagement.vue";
const insurecompanyflag = ref(0)
const changeinsurecompany = (i: number) => {
    insurecompanyflag.value = i
}
const outtabflag = ref(0)
// 切换tab
const changeouttab = (i: number) => {
    console.log(i)
    outtabflag.value = i
}
const back = () => {
    window.history.back()
}
const cubTitle = computed(() => {
    const map = {
        0: '方案管理',
        1: '行业管理',
        2: '保司管理'
    }
    return map[outtabflag.value]
})
</script>

<style lang="scss" scoped>
.popoverfn {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #565868;
    font-size: 14px;
    height: 34px;
    line-height: 34px;
    cursor: pointer;
}

.popoverfn:hover {
    background-color: #EBEFFE;
    color: #3E5FF5;
}

.paddingbox_l {
    width: 350px;
    background-color: #ffffff;
    box-sizing: border-box;
    padding: 24px;
    margin-right: 16px;
    border-radius: 8px;
    height: 81vh;
    overflow: auto;

    .paddingbox_ltitle {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding-bottom: 8px;
        border-bottom: 1px solid #F4F4F7;
        font-size: 14px;
        font-weight: 700;
        color: #202536;
    }

    .insurecompanylist:hover {
        background-color: #EBEFFE;
        border-radius: 4px;
    }

    .insurecompanylist {
        width: 100%;
        box-sizing: border-box;
        padding: 6px 12px 6px 8px;
        display: flex;
        align-items: center;

        .insurelogo {
            width: 40px;
            height: 40px;
            border-radius: 5px;
            border: 1px solid #ffffff;
        }

        .companyinfo {
            flex: 1;
            padding-left: 12px;

            .insurename {
                font-size: 14px;
                color: #202536;
                margin-right: 8px;
            }

            .insureengname {
                font-size: 12px;
                color: #565868;
            }

            .insurecode {
                margin-top: 6px;
                color: #9497B1;
                font-size: 12px;
            }

        }

        .moreimg {
            width: 24px;
            height: 24px;
        }
    }
}

.paddingbox_r {
    background-color: #ffffff;
    flex: 1;
    box-sizing: border-box;
    padding: 24px;
    border-radius: 8px;
    height: 81vh;
    overflow: auto;

    .form {
        margin-top: 12px;
        display: flex;
        align-items: center;
        justify-content: space-between;

        span {
            color: #202536;
            font-size: 14px;
        }
    }

    .toptitle {
        font-size: 16px;
        color: #202536;
        margin-bottom: 12px;
        font-weight: 600;
    }
}

.tableborder {
    border: 1px solid #EAEAEF;
    border-bottom: none !important;
}

.paginationborder {
    border: 1px solid #EAEAEF;
    padding-bottom: 16px;
}

.accounttable {
    width: 100%;
    box-sizing: border-box;
    background-color: #ffffff;
    border-radius: 8px;
    padding: 24px;
}

.formbox {
    background-color: #ffffff;
    width: 100%;
    box-sizing: border-box;
    padding: 0 8px;
    border-radius: 8px;

    .formcontent {
        padding: 0 12px 16px;
        width: 100%;
        box-sizing: border-box;
        display: flex;
        align-items: center;
        justify-content: space-between;

        .formbtnitem {
            margin-top: 13px;
        }

        .formitem {
            margin-top: 16px;
            display: flex;
            align-items: center;

            .formitemflexone {
                display: flex;
                align-items: center;
                flex: 1;
                margin-right: 42px;
            }

            .lable {
                min-width: 70px;
                font-size: 14px;
                color: #202536;
                margin-right: 8px;
            }
        }
    }

    .top {
        width: 100%;
        box-sizing: border-box;
        display: flex;
        justify-content: space-between;
        padding: 16px 8px;
        align-items: center;
        border-bottom: 1px solid #F4F4F7;

        .toptext {
            color: #3D3D3D;
            font-size: 14px;
        }

        .utils {
            display: flex;
            align-items: center;
        }

        .clear {
            cursor: pointer;
            margin-right: 20px;
            margin-left: 24px;
            color: #9497B1;
            font-size: 14px;

            img {
                width: 16px;
                height: 16px;
                margin-right: 6px;
                margin-bottom: -3px;
            }
        }
    }
}

.paddingbox {
    width: 100%;
    box-sizing: border-box;
    padding: 16px;
}

.outtabbox {
    cursor: pointer;
    width: 100%;
    box-sizing: border-box;
    padding: 0 24px;
    display: flex;
    align-items: center;
    background-color: #ffffff;

    .outtabitem {
        display: flex;
        flex-direction: column;
        align-items: center;
        margin-top: 12px;
        min-width: 64px;
        margin-right: 32px;

        .border_b {
            width: 100%;
            height: 2px;
            box-sizing: border-box;
            padding: 0 14px;

            .line {
                width: 100%;
                background-color: #ffffff;
                height: 2px;
            }
        }

        .content {
            display: flex;
            align-items: center;
            margin-bottom: 12px;
            justify-content: center;
            min-width: 85px;
            position: relative;

            .tabtext {
                text-align: center;
                font-size: 16px;
                color: #9497B1;
            }

            .count {
                position: absolute;
                top: -5px;
                right: -4px;
                height: 14px;
                min-width: 16px;
                text-align: center;
                font-size: 12px;
                line-height: 14px;
                border-radius: 8px;
                background-color: #FF7642;
                color: #FFFFFF;
            }
        }
    }
}

.blueactiveword {
    color: #0256FF !important;
}

.blueactiveline {
    background-color: #0256FF !important;
}

.insurecompanylistactive {
    background-color: #EBEFFE;
    border-radius: 4px;
}
</style>
